package neu.csye.league_scheduler.controller;

import javax.swing.AbstractListModel;
import javax.swing.DefaultListModel;

import neu.csye.league_scheduler.model.Player;
import neu.csye.league_scheduler.model.Team;

public class Controller {
	
	private static Controller INSTANCE;
	
	public static Controller getInstance() {
		if (INSTANCE == null) {
			INSTANCE = new Controller();
		}
		return INSTANCE;
	}
	
	private DefaultListModel<Team> teams;
	private DefaultListModel<Player> players;
	
	private Controller() {
		
	}
	
	public AbstractListModel<Team> getTeamModel() {
		//TODO replace with backend
		teams = new DefaultListModel<>();
		teams.addElement(new Team("Team1", new Player("Player One", "player.one@fake.com")));
		teams.addElement(new Team("Team2", new Player("Player Two", "player.two@fake.com")));
		teams.addElement(new Team("Team3", new Player("Player Three", "player.three@fake.com")));
		
		return teams;
	}
	
	public AbstractListModel<Player> getPlayerModel(String team) {
		//TODO replace with backend
		players = new DefaultListModel<>();
		players.addElement(new Player("Player One", "player.one@fake.com"));
		players.addElement(new Player("Player Two", "player.two@fake.com"));
		players.addElement(new Player("Player Three", "player.three@fake.com"));
		
		return players;
		
	}
}
